package ai;

import Player.Enemy;
import command.Command;

import controller.CombatEngine;

public abstract class AI extends Thread{
	public AI(Enemy enemy, CombatEngine engine){
		this.enemy = enemy;
		this.engine = engine;
		this.start();
	}
	protected CombatEngine getCombatEngine(){
		return engine;
	}
	protected Enemy getEnemy(){
		return enemy;
	}
	
	public synchronized void run(){
		while(true){
			while(engine.getState() != CombatEngine.State.ENEMY_TURN){
				try {
					this.wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
			engine.setMonsterCommand(selectCommand());
		}
	}
	
	public abstract Command selectCommand();
	
	private Enemy enemy;
	private CombatEngine engine;
}
